<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>用户管理</title>
    <!--<script src="libs/js/jquery-3.2.1.min.js" type="text/javascript"></script>-->
    <!--<script src="libs/layui/layui.js" type="text/javascript"></script>-->
    <!--<link rel="stylesheet" type="text/css" href="libs/layui/css/layui.css">-->
    <!--<link rel="stylesheet" type="text/css" href="libs/layui/layui.all.js">-->
    <!--<link rel="stylesheet" type="text/css" href="libs/css/bootstrap.min.css">-->
</head>
<body>
<table class="layui-table">
</table>
<div class="container">
    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a role="button">
                        园区介绍
                    </a>
                    <span class="sett" istj="false" tag="gardenIntroduction" style="float: right">修改</span>
                </h4>
            </div>
            <div class="">
                <div class="panel-body" id="gardenIntroduction">
                    园区介绍
                </div>
            </div>
        </div>

    </div>
    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a role="button">
                        入园条件
                    </a>
                    <span class="sett" istj="false" tag="inGardenCondition" style="float: right">修改</span>
                </h4>
            </div>
            <div class="">
                <div class="panel-body" id="inGardenCondition">
                    入园条件
                </div>
            </div>
        </div>

    </div>
    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a role="button">
                        入园引导
                    </a>
                    <span class="sett" istj="false" tag="inGardenFlow" style="float: right">修改</span>
                </h4>
            </div>
            <div class="">
                <div class="panel-body" id="inGardenFlow">
                    入园引导
                </div>
            </div>
        </div>

    </div>
    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a role="button">
                        入园须知
                    </a>
                    <span class="sett" istj="false" tag="inGardenKnow" style="float: right">修改</span>
                </h4>
            </div>
            <div class="">
                <div class="panel-body" id="inGardenKnow">
                    入园须知
                </div>
            </div>
        </div>

    </div>

</div>

</body>
</html>
<script type="text/javascript">
    $(".sett").click(function () {
        var tag =  $(this).attr("tag");
        // console.log($("#" + tag).val())
        if ($(this).attr("istj") == 'true') {
            var v = $("#" + $(this).attr("tag")).val();
            var tjdata = {};
            tjdata[tag] = v;
            tjdata.id = 1;
            $.ajax({
                url: 'gardenGeneral/update.spring',
                type: 'post',
                dataType: 'json',
                data: tjdata,
            })
                .done(function (e) {
                    if (e.status == 'success') {
                        $("#" + tag).contents().unwrap().wrap("<div class=\"panel-body\" id=" + tag + "  ></div>");
                        $("#" + tag).html(v);
                        $(this).attr("istj", false);
                    } else {
                        alert("修改失败")
                    }

                })
                .fail(function () {
                    alert("修改失败")
                    console.log("error");
                })
                .always(function () {
                    console.log("complete");
                });
            console.log(v)
           
        } else {
            $("#" + tag).contents().unwrap().wrap("<textarea class=\"panel-body\" id=" + tag + " style=\"width: 100%;height: 100%\" ></textarea>");
            $(this).attr("istj", true);
        }

    });
    getset();

    function getset() {
        //
        $.ajax({
            url: 'gardenGeneral/look.spring',
            // type: 'default GET (Other values: POST)',
            dataType: 'json',
            data: {pageIndex: pagenum},
        })
            .done(function (e) {
                $("#gardenIntroduction").html(e.data.gardenIntroduction);
                $("#inGardenCondition").html(e.data.inGardenCondition);
                $("#inGardenFlow").html(e.data.inGardenFlow);
                $("#inGardenKnow").html(e.data.inGardenKnow);
            })
            .fail(function () {
                console.log("error");
            })
            .always(function () {
                console.log("complete");
            });
    }


</script>